import com.hansheng.dao.MotherSheetDao;
import com.hansheng.entity.MotherSheetEntity;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by GoldenMan on 2017/5/29.
 */
public class testMotherSheetDao extends SpringTestCase {
    private MotherSheetDao motherSheetDao;
private static int counter=1;
    @Override
    protected void setUp() throws Exception {
        super.setUp();
        motherSheetDao = (MotherSheetDao) getFactory().getBean("motherSheetDao");
    }

    @Override
    protected void tearDown() throws Exception {
        super.tearDown();
    }
    public void testMaterialDao(){
        MotherSheetEntity motherSheetEntity = new MotherSheetEntity();
        motherSheetEntity.setMid(1);
        motherSheetEntity.setMsNo(getMsNo());
        motherSheetEntity.setMaterialDete(1);
        motherSheetEntity.setOperator(1);
        motherSheetEntity.setLength(123);
        motherSheetEntity.setWidth(213);
        motherSheetEntity.setHeight(312);
        motherSheetEntity.setCount(321);
        motherSheetEntity.setWeightThe(11.0);
        motherSheetEntity.setWeightAct(12.0);
        motherSheetEntity.setStatus(1);
        motherSheetDao.saveMotherSheet(motherSheetEntity);
System.out.println(motherSheetEntity.getMsid());
//        flag &= motherSheetDao.saveMotherSheet(sheetEntity);

    }

    private String getMsNo(){
        Date now = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
        return sdf.format(now)+"-"+counter++;
    }
}